<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cppMISC: include/designM/mediator.hpp 源文件</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript" src="../../darkmode_toggle.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">cppMISC<span id="projectnumber">&#160;v1.1</span>
   </div>
   <div id="projectbrief">cppMisc 文档系统</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="../../dir_7815f4a69fa470e020068bb120d080ef.html">designM</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">mediator.hpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../db/d94/mediator_8hpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span> </div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span><span class="preprocessor">#include &lt;type_traits&gt;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &lt;memory&gt;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#include &lt;unordered_set&gt;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="preprocessor">#include &lt;algorithm&gt;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno">   14</span> </div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span><span class="preprocessor">#if !defined( MEDIATOR_USE_TUPLE )</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="../../db/d94/mediator_8hpp.html#a8b86eeafbc3dfcc1270e9df0c18f90a4">   16</a></span><span class="preprocessor">#    define MEDIATOR_USE_TUPLE (1)</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span><span class="preprocessor">#if MEDIATOR_USE_TUPLE == 1</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span><span class="preprocessor">#    include &lt;tuple&gt;</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="preprocessor">#    include &lt;thread&gt;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="preprocessor">#    include &lt;condition_variable&gt;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span><span class="preprocessor">#    include &lt;functional&gt;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="preprocessor">#    include &lt;mutex&gt;</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span><span class="preprocessor">#    include &lt;queue&gt;</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span><span class="preprocessor">#    include &lt;atomic&gt;</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno">   27</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span> </div>
<div class="foldopen" id="foldopen00029" data-start="{" data-end="}">
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="../../d4/da4/namespaceprivate____.html">   29</a></span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../d4/da4/namespaceprivate____.html">private__</a></div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span>{</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"><a class="line" href="../../df/db8/structprivate_____1_1colleague_base.html">   31</a></span>    <span class="keyword">struct </span><a class="code hl_struct" href="../../df/db8/structprivate_____1_1colleague_base.html">colleagueBase</a>{};</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span>}</div>
</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span> </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../df/d8d/namespacewheels.html">wheels</a> {</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span><span class="keyword">namespace </span>dm {</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span><span class="comment">// 在不使用异步操作的时候使用直接传递消息参数的方式。这个时候发送和接收处理直接使用参数的方式进行</span></div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span><span class="comment">// 传递。当使用异步方式进行中介处理的时候接收处理的参数实际被封包成std::tuple。</span></div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span><span class="comment">// 因为异步传递的时候数据内容需要进行排队，这要求能够有容器临时存储数据内容。考虑到模块的通用性和</span></div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span><span class="comment">// 对消息结构的复杂性，所以使用std::tuple的方式。</span></div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno">   41</span><span class="preprocessor">#if MEDIATOR_USE_TUPLE</span></div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span>    <span class="keyword">template</span>&lt; <span class="keyword">typename</span> MEDIATOR , <span class="keyword">typename</span> ...PARAMS &gt;</div>
<div class="foldopen" id="foldopen00043" data-start="{" data-end="};">
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html">   43</a></span>    <span class="keyword">struct </span><a class="code hl_struct" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html">colleagueItfc</a> : <span class="keyword">public</span> <a class="code hl_struct" href="../../df/db8/structprivate_____1_1colleague_base.html">private__::colleagueBase</a> , <span class="keyword">public</span> std::enable_shared_from_this&lt;colleagueItfc&lt;MEDIATOR , PARAMS...&gt; &gt;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno">   44</span>    {</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span>    <span class="keyword">public</span>:</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a8d96fd02ad0f7ecd434b310e344a17fb">   46</a></span>        <span class="keyword">using </span><a class="code hl_typedef" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a8d96fd02ad0f7ecd434b310e344a17fb">mediator_t</a> = <span class="keyword">typename</span> std::remove_pointer&lt; typename std::decay&lt;MEDIATOR&gt;::type &gt;::type;</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#ac148c720bfc57e1ae7c377378584c06f">   47</a></span>        <span class="keyword">using </span><a class="code hl_typedef" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#ac148c720bfc57e1ae7c377378584c06f">mediaItfc_t</a> = <span class="keyword">typename</span> <a class="code hl_typedef" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a19f37297c7aceebfc37dea6df052d814">mediator_t::itfc_t</a>;</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a00a3d0ae548207e8d96ed540999a9da7">   48</a></span>        <span class="keyword">using </span><a class="code hl_typedef" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a00a3d0ae548207e8d96ed540999a9da7">tuple_t</a> = std::tuple&lt; PARAMS... &gt;;</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno">   49</span>    <span class="keyword">protected</span>:</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">   50</a></span>        std::shared_ptr&lt; mediator_t &gt;    <a class="code hl_variable" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">pt_mediator__</a>;</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span>    <span class="keyword">public</span>:</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a39c71c2549cd99aa79f5a92100750170">   52</a></span>        <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a39c71c2549cd99aa79f5a92100750170">colleagueItfc</a>( std::shared_ptr&lt; mediator_t &gt; m ):<a class="code hl_variable" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">pt_mediator__</a>(m){}</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a16b86bd2c781f536b4ad396cdf576d23">   53</a></span>        <span class="keyword">virtual</span> <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a16b86bd2c781f536b4ad396cdf576d23">~colleagueItfc</a>(){}</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span>        <span class="comment">// 发送消息接口，消息内容和数量是可以根据实际使用情况进行变化的</span></div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...Params&gt;</div>
<div class="foldopen" id="foldopen00056" data-start="{" data-end="}">
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a8bab3dc52985c6317f56d2d52996a18b">   56</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a8bab3dc52985c6317f56d2d52996a18b">send</a>( Params&amp;&amp; ...args){</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span>            <a class="code hl_variable" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">pt_mediator__</a>-&gt;dispatch( (<a class="code hl_typedef" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#ac148c720bfc57e1ae7c377378584c06f">mediaItfc_t</a>*)<span class="keyword">this</span> , std::forward&lt;Params&gt;(args)...);</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span>        }</div>
</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...Params&gt;</div>
<div class="foldopen" id="foldopen00060" data-start="{" data-end="}">
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#adee171423e59bc73237881a41cd459f4">   60</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#adee171423e59bc73237881a41cd459f4">sendTo</a>( std::shared_ptr&lt; mediaItfc_t &gt; to , Params&amp;&amp; ...args ){</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span>            <a class="code hl_variable" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">pt_mediator__</a>-&gt;dispatchTo( to , std::forward&lt;Params&gt;(args)...);</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span>        };</div>
</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...Params&gt;</div>
<div class="foldopen" id="foldopen00064" data-start="{" data-end="}">
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#aaf18ecf6101855f8931eac4aa0ca5d35">   64</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#aaf18ecf6101855f8931eac4aa0ca5d35">sendToDests</a>( std::vector&lt; std::shared_ptr&lt; mediaItfc_t &gt; &gt; dests , Params&amp;&amp; ...args ){</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno">   65</span>            <a class="code hl_variable" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">pt_mediator__</a>-&gt;dispatchToDests( dests , std::forward&lt;Params&gt;(args)...);</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno">   66</span>        };</div>
</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span>        <span class="comment">// 接收处理接口</span></div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"><a class="line" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#ac8139331c4d748d261ebd5ecb50c178a">   68</a></span>        <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#ac8139331c4d748d261ebd5ecb50c178a">recv</a>( <span class="keyword">const</span> std::tuple&lt;PARAMS...&gt;&amp; tpl  ) = 0;</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span>    };</div>
</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span>    <span class="keyword">template</span>&lt; <span class="keyword">typename</span> MEDIATOR , <span class="keyword">typename</span> ...PARAMS &gt;</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span>    <span class="keyword">struct </span><a class="code hl_struct" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html">colleagueItfc</a> : <span class="keyword">public</span> <a class="code hl_struct" href="../../df/db8/structprivate_____1_1colleague_base.html">private__::colleagueBase</a></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span>    {</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span>    <span class="keyword">public</span>:</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span>        <span class="keyword">using </span><a class="code hl_class" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html">mediator_t</a> = <span class="keyword">typename</span> std::remove_pointer&lt; typename std::decay&lt;MEDIATOR&gt;::type &gt;::type;</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span>        <span class="keyword">using </span><a class="code hl_typedef" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#ac148c720bfc57e1ae7c377378584c06f">mediaItfc_t</a> = <span class="keyword">typename</span> <a class="code hl_typedef" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a19f37297c7aceebfc37dea6df052d814">mediator_t::itfc_t</a>;</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span>    <span class="keyword">protected</span>:</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span>        std::shared_ptr&lt; mediator_t &gt;    <a class="code hl_variable" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">pt_mediator__</a>;</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span>    <span class="keyword">public</span>:</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span>        <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a39c71c2549cd99aa79f5a92100750170">colleagueItfc</a>( std::shared_ptr&lt; mediator_t &gt; m ):<a class="code hl_variable" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">pt_mediator__</a>(m){}</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno">   81</span>        <span class="keyword">virtual</span> <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a16b86bd2c781f536b4ad396cdf576d23">~colleagueItfc</a>(){}</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span> </div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...Params&gt;</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a8bab3dc52985c6317f56d2d52996a18b">send</a>( Params&amp;&amp; ...args){</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span>            <a class="code hl_variable" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">pt_mediator__</a>-&gt;dispatch( (<a class="code hl_typedef" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#ac148c720bfc57e1ae7c377378584c06f">mediaItfc_t</a>*)<span class="keyword">this</span> , std::forward&lt;Params&gt;(args)...);</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span>        }</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno">   87</span> </div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno">   88</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...Params&gt;</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno">   89</span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#adee171423e59bc73237881a41cd459f4">sendTo</a>( std::shared_ptr&lt; mediaItfc_t &gt; to , Params&amp;&amp; ...args ){</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno">   90</span>            <a class="code hl_variable" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">pt_mediator__</a>-&gt;dispatchTo( to , std::forward&lt;Params&gt;(args)...);</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno">   91</span>        };</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno">   92</span> </div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno">   93</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...Params&gt;</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#aaf18ecf6101855f8931eac4aa0ca5d35">sendToDests</a>( std::vector&lt; std::shared_ptr&lt; mediaItfc_t &gt; &gt; dests , Params&amp;&amp; ...args ){</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span>            <a class="code hl_variable" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">pt_mediator__</a>-&gt;dispatchToDests( dests , std::forward&lt;Params&gt;(args)...);</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno">   96</span>        };</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno">   97</span> </div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>        <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#ac8139331c4d748d261ebd5ecb50c178a">recv</a>( <span class="keyword">const</span> PARAMS&amp; ...args ) = 0;</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span>    };</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span> </div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span>    <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ITFC_TYPE </div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span><span class="preprocessor">#if MEDIATOR_USE_TUPLE</span></div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span>          , <span class="keyword">typename</span> ...Params</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno">  105</span><span class="preprocessor">#endif      </span></div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno">  106</span>          &gt;</div>
<div class="foldopen" id="foldopen00107" data-start="{" data-end="};">
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html">  107</a></span>    <span class="keyword">class </span><a class="code hl_class" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html">mediator</a></div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno">  108</span>    {</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>    <span class="keyword">public</span>:</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a19f37297c7aceebfc37dea6df052d814">  110</a></span>        <span class="keyword">using </span><a class="code hl_typedef" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a19f37297c7aceebfc37dea6df052d814">itfc_t</a> = <span class="keyword">typename</span> std::remove_pointer&lt; typename std::decay&lt;ITFC_TYPE&gt;::type &gt;::type;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a4358ad34614e37b23e1a129e03b81f89">  111</a></span>        <span class="keyword">using </span><a class="code hl_typedef" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a4358ad34614e37b23e1a129e03b81f89">data_t</a> = std::unordered_set&lt; std::shared_ptr&lt; itfc_t &gt; &gt;;</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno">  112</span><span class="preprocessor">#if MEDIATOR_USE_TUPLE</span></div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ab3d438273c92d65cc530b1071cd81e99">  113</a></span>        <span class="keyword">using </span><a class="code hl_typedef" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ab3d438273c92d65cc530b1071cd81e99">tuple_t</a> = <span class="keyword">typename</span> std::tuple&lt;Params...&gt;;</div>
<div class="foldopen" id="foldopen00115" data-start="{" data-end="};">
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"><a class="line" href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html">  115</a></span>        <span class="keyword">struct </span><a class="code hl_struct" href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html">stMsgs</a>{</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"><a class="line" href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html#abc45b4729e2f0b1585a5292d160cf249">  116</a></span>            std::shared_ptr&lt; itfc_t &gt;   <a class="code hl_variable" href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html#abc45b4729e2f0b1585a5292d160cf249">pt_dst__</a>;   <span class="comment">// 接收者</span></div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"><a class="line" href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html#af9d9db6a849870ba8d682f988812eb07">  117</a></span>            std::shared_ptr&lt; tuple_t &gt;  <a class="code hl_variable" href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html#af9d9db6a849870ba8d682f988812eb07">m_data__</a>;   <span class="comment">// 消息内容</span></div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno">  118</span>        };</div>
</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno">  119</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno">  120</span>    <span class="keyword">protected</span>:</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">  121</a></span>        <a class="code hl_typedef" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a4358ad34614e37b23e1a129e03b81f89">data_t</a>                    <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>;    <span class="comment">// 同事表</span></div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno">  122</span> </div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno">  123</span><span class="preprocessor">#if  MEDIATOR_USE_TUPLE </span></div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">  124</a></span>        std::queue&lt; stMsgs &gt;      <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">m_msgs__</a>;         <span class="comment">// 消息队列</span></div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a438bbe81ba1bbc618502fe0236d15d3d">  125</a></span>        std::condition_variable   <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a438bbe81ba1bbc618502fe0236d15d3d">m_cnd_var__</a>;      <span class="comment">// 采用异步处理需要考虑线程安全性</span></div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#aa119454e1321f9b45477a878f87c86df">  126</a></span>        std::atomic&lt; bool &gt;       <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#aa119454e1321f9b45477a878f87c86df">m_is_running__</a>;   <span class="comment">// 线程运行标记</span></div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a46bb315e82767596e208d4147834c27b">  127</a></span>        std::mutex                <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a46bb315e82767596e208d4147834c27b">m_mutex__</a>;</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno">  128</span>    <span class="keyword">protected</span>:</div>
<div class="foldopen" id="foldopen00132" data-start="{" data-end="}">
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8a82aa636c133b1f5305434b7edc9eb3">  132</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8a82aa636c133b1f5305434b7edc9eb3">backend__</a>(){</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span>            <span class="keywordflow">while</span>( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#aa119454e1321f9b45477a878f87c86df">m_is_running__</a>.load() ){</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span>                std::unique_lock&lt; std::mutex &gt; lck( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a46bb315e82767596e208d4147834c27b">m_mutex__</a> );</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span> </div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span>                <span class="keywordflow">if</span>( !<a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">m_msgs__</a>.empty() ){</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno">  139</span>                    <span class="keyword">auto</span> item = <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">m_msgs__</a>.front();</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno">  140</span>                    item.pt_dst__-&gt;recv( *item.m_data__ );</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno">  141</span>                    <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">m_msgs__</a>.pop();</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno">  142</span>                }<span class="keywordflow">else</span>{</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno">  143</span>                    <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a438bbe81ba1bbc618502fe0236d15d3d">m_cnd_var__</a>.wait( lck );</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno">  144</span>                }</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno">  145</span>            }</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno">  146</span>        }</div>
</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno">  147</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span>    <span class="keyword">public</span>:</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a2d7ae4ac4b6a19f08bd9f5087cb66968">  149</a></span>        <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a2d7ae4ac4b6a19f08bd9f5087cb66968">mediator</a>():<a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#aa119454e1321f9b45477a878f87c86df">m_is_running__</a>( false ){}</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ab234b394a7000fe5fba20c05419b2e8c">  150</a></span>        <span class="keyword">virtual</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ab234b394a7000fe5fba20c05419b2e8c">~mediator</a>(){}</div>
<div class="foldopen" id="foldopen00155" data-start="{" data-end="}">
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a9aecb8062ad33c4b7a537b0bce646fee">  155</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a9aecb8062ad33c4b7a537b0bce646fee">add</a>( std::shared_ptr&lt; itfc_t &gt; colleague) {</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno">  156</span><span class="preprocessor">#if MEDIATOR_USE_TUPLE </span></div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno">  157</span>            std::unique_lock&lt; std::mutex &gt;  lck( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a46bb315e82767596e208d4147834c27b">m_mutex__</a> );</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno">  158</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno">  159</span>            <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.insert(colleague);</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno">  160</span>        }</div>
</div>
<div class="foldopen" id="foldopen00165" data-start="{" data-end="}">
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a692304c6beb4cdfb126f8382eda448b8">  165</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a692304c6beb4cdfb126f8382eda448b8">erase</a>( std::shared_ptr&lt; itfc_t &gt; colleague) {</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno">  166</span><span class="preprocessor">#if MEDIATOR_USE_TUPLE </span></div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno">  167</span>            std::unique_lock&lt; std::mutex &gt;  lck( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a46bb315e82767596e208d4147834c27b">m_mutex__</a> );</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno">  168</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno">  169</span>            <span class="keyword">auto</span> it = std::find( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.begin() , <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.end() , colleague );</div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno">  170</span>            <span class="keywordflow">if</span>( it != <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.end() ){</div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno">  171</span>                <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.erase( it );</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno">  172</span>            }</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno">  173</span>        }</div>
</div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno">  174</span> </div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno">  175</span><span class="preprocessor">#if  MEDIATOR_USE_TUPLE </span></div>
<div class="foldopen" id="foldopen00181" data-start="{" data-end="}">
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ad55a516465f254f306634610538f10d7">  181</a></span>        <span class="keywordtype">bool</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ad55a516465f254f306634610538f10d7">run</a>( <span class="keywordtype">bool</span> sw ){</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno">  182</span>            <span class="keywordflow">if</span>( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#aa119454e1321f9b45477a878f87c86df">m_is_running__</a>.load() == sw ) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno">  183</span> </div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno">  184</span>            <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#aa119454e1321f9b45477a878f87c86df">m_is_running__</a> = sw;</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno">  185</span>            <span class="keywordflow">if</span>( sw ){</div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno">  186</span>                std::thread thd( std::bind( &amp;<a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8a82aa636c133b1f5305434b7edc9eb3">mediator::backend__</a> ,  <span class="keyword">this</span> ) );</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno">  187</span>                thd.detach();</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno">  188</span>            }<span class="keywordflow">else</span>{ <span class="comment">// 结束后台线程的时候先把运行标志设置为false，然后清理掉所有已经在排队的</span></div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno">  189</span>                <span class="comment">// 消息；然后通知再等待的线程结束等待。</span></div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno">  190</span>                std::unique_lock&lt; std::mutex &gt; lck( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a46bb315e82767596e208d4147834c27b">m_mutex__</a> );</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno">  191</span>                <span class="keywordflow">while</span>( !<a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">m_msgs__</a>.empty() ){</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno">  192</span>                    <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">m_msgs__</a>.pop();</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno">  193</span>                }</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno">  194</span> </div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno">  195</span>                <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a438bbe81ba1bbc618502fe0236d15d3d">m_cnd_var__</a>.notify_one();</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno">  196</span>            }</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno">  197</span> </div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno">  198</span>            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno">  199</span>        }</div>
</div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno">  200</span> </div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno">  207</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...PARAMS &gt;</div>
<div class="foldopen" id="foldopen00208" data-start="{" data-end="}">
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a9331abcc14e73753ccb6ccd96673df38">  208</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a9331abcc14e73753ccb6ccd96673df38">dispatch</a>(<a class="code hl_typedef" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a19f37297c7aceebfc37dea6df052d814">itfc_t</a> * sender, PARAMS&amp;&amp; ...args ) {</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno">  209</span>            <span class="keyword">static_assert</span>( std::is_base_of&lt;private__::colleagueBase , itfc_t &gt;::value , <span class="stringliteral">&quot;&quot;</span> );</div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno">  210</span>            </div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno">  211</span>            <span class="keyword">auto</span> pt_tpl = std::make_shared&lt; std::tuple&lt; typename std::decay&lt;PARAMS&gt;::type...&gt; &gt;( std::forward&lt;PARAMS&gt;(args)... );</div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno">  212</span>            std::unique_lock&lt; std::mutex &gt;  lck( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a46bb315e82767596e208d4147834c27b">m_mutex__</a> );</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno">  213</span> </div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno">  214</span>            <span class="keywordflow">for</span> (<span class="keyword">auto</span> colleague : <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>) {</div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno">  215</span>                <span class="keywordflow">if</span> (colleague.get() != sender) {</div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno">  216</span>                    <a class="code hl_struct" href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html">stMsgs</a> msg = { colleague , pt_tpl };</div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno">  217</span>                    <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">m_msgs__</a>.push( msg );</div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno">  218</span>                }</div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno">  219</span>            }</div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno">  220</span> </div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno">  221</span>            <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a438bbe81ba1bbc618502fe0236d15d3d">m_cnd_var__</a>.notify_one();</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno">  222</span>        }</div>
</div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno">  229</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...PARAMS &gt;</div>
<div class="foldopen" id="foldopen00230" data-start="{" data-end="}">
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ad09a4c9562bfa80883e535a098406dd0">  230</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ad09a4c9562bfa80883e535a098406dd0">dispatchTo</a>(std::shared_ptr&lt; itfc_t &gt; to, PARAMS&amp;&amp; ...args ) {</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno">  231</span>            <span class="keyword">static_assert</span>( std::is_base_of&lt;private__::colleagueBase , itfc_t &gt;::value , <span class="stringliteral">&quot;&quot;</span> );</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno">  232</span>            <span class="keyword">auto</span> it = std::find_if( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.begin() , <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.end(), [=]( std::shared_ptr&lt;itfc_t&gt; ptr )-&gt;bool{</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno">  233</span>                if( ptr.get() == to.get() ) return true;</div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno">  234</span>                return false;</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno">  235</span>            } );</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno">  236</span>            </div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno">  237</span>            <span class="keywordflow">if</span>( it != <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.end() ){</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno">  238</span>                <span class="keyword">auto</span> pt_tpl = std::make_shared&lt; std::tuple&lt; typename std::decay&lt;PARAMS&gt;::type...&gt; &gt;( std::forward&lt;PARAMS&gt;(args)... );</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno">  239</span>                <a class="code hl_struct" href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html">stMsgs</a> msg = { to , pt_tpl };</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno">  240</span>                <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">m_msgs__</a>.push( msg );</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno">  241</span>            }</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno">  242</span> </div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno">  243</span>            <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a438bbe81ba1bbc618502fe0236d15d3d">m_cnd_var__</a>.notify_one();</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno">  244</span>        }</div>
</div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno">  251</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...PARAMS &gt;</div>
<div class="foldopen" id="foldopen00252" data-start="{" data-end="}">
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"><a class="line" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a16cb0700c56767a896e9426fb612ee95">  252</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a16cb0700c56767a896e9426fb612ee95">dispatchToDests</a>( std::vector&lt; std::shared_ptr&lt; itfc_t &gt; &gt; dests, PARAMS&amp;&amp; ...args ) {</div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno">  253</span>            <span class="keyword">static_assert</span>( std::is_base_of&lt;private__::colleagueBase , itfc_t &gt;::value , <span class="stringliteral">&quot;&quot;</span> );</div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno">  254</span>            <span class="comment">// 1  构造std::tuple对象，tuple的类型需要使用PARAMS进行推导，但是由于PARAMS是万能应用可能导致推导内容不能满足实际传递过来的内容完全匹配</span></div>
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno">  255</span>            <span class="comment">// 来构造tuple，所以使用std::decay移除修饰内容后再构造shared_ptr。</span></div>
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno">  256</span>            <span class="comment">// 2  使用shared_ptr方便消息传递过程里面重复的对象构造和内存拷贝。</span></div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno">  257</span>            <span class="keyword">auto</span> pt_tpl = std::make_shared&lt; std::tuple&lt;typename std::decay&lt;PARAMS&gt;::type...&gt; &gt;( std::forward&lt;PARAMS&gt;(args)... );</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno">  258</span> </div>
<div class="line"><a id="l00259" name="l00259"></a><span class="lineno">  259</span>            <span class="keywordflow">for</span>( <span class="keyword">auto</span> to : dests ){</div>
<div class="line"><a id="l00260" name="l00260"></a><span class="lineno">  260</span>                <span class="keyword">auto</span> it = std::find( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.begin() , <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.end(), to );</div>
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno">  261</span>                <span class="keywordflow">if</span>( it != <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.end() ){</div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno">  262</span>                    <a class="code hl_struct" href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html">stMsgs</a> msg = { to , pt_tpl };</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno">  263</span>                    <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">m_msgs__</a>.push( msg );</div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno">  264</span>                }</div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno">  265</span>            }</div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno">  266</span> </div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno">  267</span>            <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a438bbe81ba1bbc618502fe0236d15d3d">m_cnd_var__</a>.notify_one();</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno">  268</span>        }</div>
</div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno">  269</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00270" name="l00270"></a><span class="lineno">  270</span>        <span class="comment">// 在不适用std::tuple的情况下没有做异步处理，定义这个方法以实现代码层的兼容。</span></div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno">  271</span>        <span class="keywordtype">bool</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ad55a516465f254f306634610538f10d7">run</a>( <span class="keywordtype">bool</span> ){ <span class="keywordflow">return</span> <span class="keyword">true</span>; }</div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno">  278</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...PARAMS &gt;</div>
<div class="line"><a id="l00279" name="l00279"></a><span class="lineno">  279</span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a9331abcc14e73753ccb6ccd96673df38">dispatch</a>( <a class="code hl_typedef" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a19f37297c7aceebfc37dea6df052d814">itfc_t</a> * sender, PARAMS&amp;&amp; ...args ) {</div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno">  280</span>            <span class="keyword">static_assert</span>( std::is_base_of&lt;private__::colleagueBase , itfc_t &gt;::value , <span class="stringliteral">&quot;&quot;</span> );</div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno">  281</span>            <span class="keywordflow">for</span> (<span class="keyword">auto</span> colleague : <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>) {</div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno">  282</span>                <span class="keywordflow">if</span> (colleague.get() != sender) {</div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno">  283</span>                    colleague-&gt;recv( std::forward&lt;PARAMS&gt;( args )...);</div>
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno">  284</span>                }</div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno">  285</span>            }</div>
<div class="line"><a id="l00286" name="l00286"></a><span class="lineno">  286</span>        }</div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno">  293</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...PARAMS &gt;</div>
<div class="line"><a id="l00294" name="l00294"></a><span class="lineno">  294</span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ad09a4c9562bfa80883e535a098406dd0">dispatchTo</a>(std::shared_ptr&lt; itfc_t &gt; to, PARAMS&amp;&amp; ...args ) {</div>
<div class="line"><a id="l00295" name="l00295"></a><span class="lineno">  295</span>            <span class="keyword">static_assert</span>( std::is_base_of&lt;private__::colleagueBase , itfc_t &gt;::value , <span class="stringliteral">&quot;&quot;</span> );</div>
<div class="line"><a id="l00296" name="l00296"></a><span class="lineno">  296</span>            <span class="keyword">auto</span> it = std::find( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.begin() , <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.end(), to );</div>
<div class="line"><a id="l00297" name="l00297"></a><span class="lineno">  297</span>            <span class="keywordflow">if</span>( it != <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.end() ){</div>
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno">  298</span>                to-&gt;recv( std::forward&lt;PARAMS&gt;( args )...);</div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno">  299</span>            }</div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno">  300</span>        }</div>
<div class="line"><a id="l00301" name="l00301"></a><span class="lineno">  301</span> </div>
<div class="line"><a id="l00308" name="l00308"></a><span class="lineno">  308</span>        <span class="keyword">template</span>&lt; <span class="keyword">typename</span> ...PARAMS &gt;</div>
<div class="line"><a id="l00309" name="l00309"></a><span class="lineno">  309</span>        <span class="keywordtype">void</span> <a class="code hl_function" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a16cb0700c56767a896e9426fb612ee95">dispatchToDests</a>( std::vector&lt; std::shared_ptr&lt; itfc_t &gt; &gt; dests, PARAMS&amp;&amp; ...args ) {</div>
<div class="line"><a id="l00310" name="l00310"></a><span class="lineno">  310</span>            <span class="keyword">static_assert</span>( std::is_base_of&lt;private__::colleagueBase , itfc_t &gt;::value , <span class="stringliteral">&quot;&quot;</span> );</div>
<div class="line"><a id="l00311" name="l00311"></a><span class="lineno">  311</span>            <span class="keywordflow">for</span>( <span class="keyword">auto</span> to : dests ){</div>
<div class="line"><a id="l00312" name="l00312"></a><span class="lineno">  312</span>                <span class="keyword">auto</span> it = std::find( <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.begin() , <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.end(), to );</div>
<div class="line"><a id="l00313" name="l00313"></a><span class="lineno">  313</span>                <span class="keywordflow">if</span>( it != <a class="code hl_variable" href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">m_colleague__</a>.end() ){</div>
<div class="line"><a id="l00314" name="l00314"></a><span class="lineno">  314</span>                    to-&gt;recv( std::forward&lt;PARAMS&gt;( args )...);</div>
<div class="line"><a id="l00315" name="l00315"></a><span class="lineno">  315</span>                }</div>
<div class="line"><a id="l00316" name="l00316"></a><span class="lineno">  316</span>            }</div>
<div class="line"><a id="l00317" name="l00317"></a><span class="lineno">  317</span>        }</div>
<div class="line"><a id="l00318" name="l00318"></a><span class="lineno">  318</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00319" name="l00319"></a><span class="lineno">  319</span>    };</div>
</div>
<div class="line"><a id="l00320" name="l00320"></a><span class="lineno">  320</span>}}</div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html">wheels::dm::mediator</a></div><div class="ttdef"><b>定义</b> <a href="#l00107">mediator.hpp:108</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a16cb0700c56767a896e9426fb612ee95"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a16cb0700c56767a896e9426fb612ee95">wheels::dm::mediator::dispatchToDests</a></div><div class="ttdeci">void dispatchToDests(std::vector&lt; std::shared_ptr&lt; itfc_t &gt; &gt; dests, PARAMS &amp;&amp;...args)</div><div class="ttdoc">将消息数据添加到消息队列中，并触发后台线程。通常情况下dispatch函数在colleagueItfc的子类 中的send函数中调用</div><div class="ttdef"><b>定义</b> <a href="#l00252">mediator.hpp:252</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a19f37297c7aceebfc37dea6df052d814"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a19f37297c7aceebfc37dea6df052d814">wheels::dm::mediator::itfc_t</a></div><div class="ttdeci">typename std::remove_pointer&lt; typename std::decay&lt; ITFC_TYPE &gt;::type &gt;::type itfc_t</div><div class="ttdef"><b>定义</b> <a href="#l00110">mediator.hpp:110</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a1feb4f5fe00e8ba052ad19cecea17310"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a1feb4f5fe00e8ba052ad19cecea17310">wheels::dm::mediator::m_colleague__</a></div><div class="ttdeci">data_t m_colleague__</div><div class="ttdef"><b>定义</b> <a href="#l00121">mediator.hpp:121</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a2d7ae4ac4b6a19f08bd9f5087cb66968"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a2d7ae4ac4b6a19f08bd9f5087cb66968">wheels::dm::mediator::mediator</a></div><div class="ttdeci">mediator()</div><div class="ttdef"><b>定义</b> <a href="#l00149">mediator.hpp:149</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a4358ad34614e37b23e1a129e03b81f89"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a4358ad34614e37b23e1a129e03b81f89">wheels::dm::mediator::data_t</a></div><div class="ttdeci">std::unordered_set&lt; std::shared_ptr&lt; itfc_t &gt; &gt; data_t</div><div class="ttdef"><b>定义</b> <a href="#l00111">mediator.hpp:111</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a438bbe81ba1bbc618502fe0236d15d3d"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a438bbe81ba1bbc618502fe0236d15d3d">wheels::dm::mediator::m_cnd_var__</a></div><div class="ttdeci">std::condition_variable m_cnd_var__</div><div class="ttdef"><b>定义</b> <a href="#l00125">mediator.hpp:125</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a46bb315e82767596e208d4147834c27b"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a46bb315e82767596e208d4147834c27b">wheels::dm::mediator::m_mutex__</a></div><div class="ttdeci">std::mutex m_mutex__</div><div class="ttdef"><b>定义</b> <a href="#l00127">mediator.hpp:127</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a692304c6beb4cdfb126f8382eda448b8"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a692304c6beb4cdfb126f8382eda448b8">wheels::dm::mediator::erase</a></div><div class="ttdeci">void erase(std::shared_ptr&lt; itfc_t &gt; colleague)</div><div class="ttdoc">删除参与者</div><div class="ttdef"><b>定义</b> <a href="#l00165">mediator.hpp:165</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a8a82aa636c133b1f5305434b7edc9eb3"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8a82aa636c133b1f5305434b7edc9eb3">wheels::dm::mediator::backend__</a></div><div class="ttdeci">void backend__()</div><div class="ttdoc">后台处理线程。</div><div class="ttdef"><b>定义</b> <a href="#l00132">mediator.hpp:132</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a8df927721cda0bec256c67b99e9018f2"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a8df927721cda0bec256c67b99e9018f2">wheels::dm::mediator::m_msgs__</a></div><div class="ttdeci">std::queue&lt; stMsgs &gt; m_msgs__</div><div class="ttdef"><b>定义</b> <a href="#l00124">mediator.hpp:124</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a9331abcc14e73753ccb6ccd96673df38"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a9331abcc14e73753ccb6ccd96673df38">wheels::dm::mediator::dispatch</a></div><div class="ttdeci">void dispatch(itfc_t *sender, PARAMS &amp;&amp;...args)</div><div class="ttdoc">将消息数据添加到消息队列中，并触发后台线程。通常情况下dispatch函数在colleagueItfc的子类 中的send函数中调用</div><div class="ttdef"><b>定义</b> <a href="#l00208">mediator.hpp:208</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_a9aecb8062ad33c4b7a537b0bce646fee"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#a9aecb8062ad33c4b7a537b0bce646fee">wheels::dm::mediator::add</a></div><div class="ttdeci">void add(std::shared_ptr&lt; itfc_t &gt; colleague)</div><div class="ttdoc">增加参与者</div><div class="ttdef"><b>定义</b> <a href="#l00155">mediator.hpp:155</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_aa119454e1321f9b45477a878f87c86df"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#aa119454e1321f9b45477a878f87c86df">wheels::dm::mediator::m_is_running__</a></div><div class="ttdeci">std::atomic&lt; bool &gt; m_is_running__</div><div class="ttdef"><b>定义</b> <a href="#l00126">mediator.hpp:126</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_ab234b394a7000fe5fba20c05419b2e8c"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ab234b394a7000fe5fba20c05419b2e8c">wheels::dm::mediator::~mediator</a></div><div class="ttdeci">virtual ~mediator()</div><div class="ttdef"><b>定义</b> <a href="#l00150">mediator.hpp:150</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_ab3d438273c92d65cc530b1071cd81e99"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ab3d438273c92d65cc530b1071cd81e99">wheels::dm::mediator::tuple_t</a></div><div class="ttdeci">typename std::tuple&lt; Params... &gt; tuple_t</div><div class="ttdef"><b>定义</b> <a href="#l00113">mediator.hpp:113</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_ad09a4c9562bfa80883e535a098406dd0"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ad09a4c9562bfa80883e535a098406dd0">wheels::dm::mediator::dispatchTo</a></div><div class="ttdeci">void dispatchTo(std::shared_ptr&lt; itfc_t &gt; to, PARAMS &amp;&amp;...args)</div><div class="ttdoc">将消息数据添加到消息队列中，并触发后台线程。通常情况下dispatch函数在colleagueItfc的子类 中的send函数中调用</div><div class="ttdef"><b>定义</b> <a href="#l00230">mediator.hpp:230</a></div></div>
<div class="ttc" id="aclasswheels_1_1dm_1_1mediator_html_ad55a516465f254f306634610538f10d7"><div class="ttname"><a href="../../d1/dcc/classwheels_1_1dm_1_1mediator.html#ad55a516465f254f306634610538f10d7">wheels::dm::mediator::run</a></div><div class="ttdeci">bool run(bool sw)</div><div class="ttdoc">启动线程或者关闭线程</div><div class="ttdef"><b>定义</b> <a href="#l00181">mediator.hpp:181</a></div></div>
<div class="ttc" id="anamespaceprivate_____html"><div class="ttname"><a href="../../d4/da4/namespaceprivate____.html">private__</a></div><div class="ttdoc">代理模式</div><div class="ttdef"><b>定义</b> <a href="#l00029">mediator.hpp:30</a></div></div>
<div class="ttc" id="anamespacewheels_html"><div class="ttname"><a href="../../df/d8d/namespacewheels.html">wheels</a></div><div class="ttdoc">堆栈信息读取和保存记录</div><div class="ttdef"><b>定义</b> <a href="../../d3/df7/ary__str_8hpp_source.html#l00006">ary_str.hpp:7</a></div></div>
<div class="ttc" id="astructprivate_____1_1colleague_base_html"><div class="ttname"><a href="../../df/db8/structprivate_____1_1colleague_base.html">private__::colleagueBase</a></div><div class="ttdef"><b>定义</b> <a href="#l00031">mediator.hpp:31</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html">wheels::dm::colleagueItfc</a></div><div class="ttdef"><b>定义</b> <a href="#l00043">mediator.hpp:44</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html_a00a3d0ae548207e8d96ed540999a9da7"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a00a3d0ae548207e8d96ed540999a9da7">wheels::dm::colleagueItfc::tuple_t</a></div><div class="ttdeci">std::tuple&lt; PARAMS... &gt; tuple_t</div><div class="ttdef"><b>定义</b> <a href="#l00048">mediator.hpp:48</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html_a16b86bd2c781f536b4ad396cdf576d23"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a16b86bd2c781f536b4ad396cdf576d23">wheels::dm::colleagueItfc::~colleagueItfc</a></div><div class="ttdeci">virtual ~colleagueItfc()</div><div class="ttdef"><b>定义</b> <a href="#l00053">mediator.hpp:53</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html_a39c71c2549cd99aa79f5a92100750170"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a39c71c2549cd99aa79f5a92100750170">wheels::dm::colleagueItfc::colleagueItfc</a></div><div class="ttdeci">colleagueItfc(std::shared_ptr&lt; mediator_t &gt; m)</div><div class="ttdef"><b>定义</b> <a href="#l00052">mediator.hpp:52</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html_a69edda6c42eadba29bbba2a4673a9645"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a69edda6c42eadba29bbba2a4673a9645">wheels::dm::colleagueItfc::pt_mediator__</a></div><div class="ttdeci">std::shared_ptr&lt; mediator_t &gt; pt_mediator__</div><div class="ttdef"><b>定义</b> <a href="#l00050">mediator.hpp:50</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html_a8bab3dc52985c6317f56d2d52996a18b"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a8bab3dc52985c6317f56d2d52996a18b">wheels::dm::colleagueItfc::send</a></div><div class="ttdeci">void send(Params &amp;&amp;...args)</div><div class="ttdef"><b>定义</b> <a href="#l00056">mediator.hpp:56</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html_a8d96fd02ad0f7ecd434b310e344a17fb"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#a8d96fd02ad0f7ecd434b310e344a17fb">wheels::dm::colleagueItfc::mediator_t</a></div><div class="ttdeci">typename std::remove_pointer&lt; typename std::decay&lt; MEDIATOR &gt;::type &gt;::type mediator_t</div><div class="ttdef"><b>定义</b> <a href="#l00046">mediator.hpp:46</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html_aaf18ecf6101855f8931eac4aa0ca5d35"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#aaf18ecf6101855f8931eac4aa0ca5d35">wheels::dm::colleagueItfc::sendToDests</a></div><div class="ttdeci">void sendToDests(std::vector&lt; std::shared_ptr&lt; mediaItfc_t &gt; &gt; dests, Params &amp;&amp;...args)</div><div class="ttdef"><b>定义</b> <a href="#l00064">mediator.hpp:64</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html_ac148c720bfc57e1ae7c377378584c06f"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#ac148c720bfc57e1ae7c377378584c06f">wheels::dm::colleagueItfc::mediaItfc_t</a></div><div class="ttdeci">typename mediator_t::itfc_t mediaItfc_t</div><div class="ttdef"><b>定义</b> <a href="#l00047">mediator.hpp:47</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html_ac8139331c4d748d261ebd5ecb50c178a"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#ac8139331c4d748d261ebd5ecb50c178a">wheels::dm::colleagueItfc::recv</a></div><div class="ttdeci">virtual void recv(const std::tuple&lt; PARAMS... &gt; &amp;tpl)=0</div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1colleague_itfc_html_adee171423e59bc73237881a41cd459f4"><div class="ttname"><a href="../../da/d74/structwheels_1_1dm_1_1colleague_itfc.html#adee171423e59bc73237881a41cd459f4">wheels::dm::colleagueItfc::sendTo</a></div><div class="ttdeci">void sendTo(std::shared_ptr&lt; mediaItfc_t &gt; to, Params &amp;&amp;...args)</div><div class="ttdef"><b>定义</b> <a href="#l00060">mediator.hpp:60</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1mediator_1_1st_msgs_html"><div class="ttname"><a href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html">wheels::dm::mediator::stMsgs</a></div><div class="ttdoc">定义消息结构，消息结构中包含了接收者和消息数据内容</div><div class="ttdef"><b>定义</b> <a href="#l00115">mediator.hpp:115</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1mediator_1_1st_msgs_html_abc45b4729e2f0b1585a5292d160cf249"><div class="ttname"><a href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html#abc45b4729e2f0b1585a5292d160cf249">wheels::dm::mediator::stMsgs::pt_dst__</a></div><div class="ttdeci">std::shared_ptr&lt; itfc_t &gt; pt_dst__</div><div class="ttdef"><b>定义</b> <a href="#l00116">mediator.hpp:116</a></div></div>
<div class="ttc" id="astructwheels_1_1dm_1_1mediator_1_1st_msgs_html_af9d9db6a849870ba8d682f988812eb07"><div class="ttname"><a href="../../d6/d63/structwheels_1_1dm_1_1mediator_1_1st_msgs.html#af9d9db6a849870ba8d682f988812eb07">wheels::dm::mediator::stMsgs::m_data__</a></div><div class="ttdeci">std::shared_ptr&lt; tuple_t &gt; m_data__</div><div class="ttdef"><b>定义</b> <a href="#l00117">mediator.hpp:117</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
